package jh.com.jhappbf.weight.query;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.ab.activity.AbActivity;
import com.ab.view.titlebar.AbTitleBar;

import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager;
import butterknife.BindView;
import jh.com.jhappbf.R;

/**
 * @author Administrator
 */
public class QueryWeight extends AbActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setAbContentView(R.layout.query_weight_activity);

        AbTitleBar mAbTitleBar = this.getTitleBar();
        mAbTitleBar.setTitleText("称重查询");
        mAbTitleBar.setLogo(R.drawable.button_selector_back);
        mAbTitleBar.setTitleBarBackgroundColor(ContextCompat.getColor(this, R.color.orange));
        mAbTitleBar.setTitleTextMargin(10, 0, 0, 0);
        mAbTitleBar.setLogoLine(R.mipmap.line);
        Intent i = getIntent();
        String mFlag = i.getStringExtra("flag");
        View rightViewMore = mInflater.inflate(R.layout.title_right_btn, null);
        switch (mFlag) {
            case "plan":
                rightViewMore.setVisibility(View.GONE);
                break;
            case "buy":
                mAbTitleBar.setTitleText("采购查询");
                break;
            case "sale":
                mAbTitleBar.setTitleText("销售查询");
                break;
            case "dao":
                mAbTitleBar.setTitleText("内倒查询");
                break;
            case "ling":
                mAbTitleBar.setTitleText("零售查询");
                break;
            case "out":
                mAbTitleBar.setTitleText("对外查询");
                break;
            default:
                break;
        }

        mAbTitleBar.addRightView(rightViewMore);
        FragmentManager fManager = getSupportFragmentManager();
        if (fManager.findFragmentById(R.id.query_weight_frame) == null) {
            QueryWeightListView2 fragment = new QueryWeightListView2();
            fManager.beginTransaction().replace(R.id.query_weight_frame, fragment).commit();
        }
    }

    @Override
    public void onBackPressed() {
        finish();
    }
}

